package com.example.demo.run.Controller;

import com.example.demo.tools.otherTools.CommonUtil;
import com.example.demo.tools.pianoTools.piano;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;

@RestController
@RequestMapping("piano")
public class PianoCon {
//    @RequestMapping( value="getPiano",method=RequestMethod.POST)
    @PostMapping("/getPiano")
    public void hello(HttpServletResponse response, HttpServletRequest request){
//        ModelMap song = piano.song();
    	ArrayList<ModelMap> r2 = piano.r2();
//    	for (int i = 0; i < r2.size(); i ++ ){
//            System.out.println(r2.get(i).get("key") + " :" + r2.get(i).get("time"));
//        }
        CommonUtil.toJson(new ModelMap("data",r2),response);
    }
}
